<extend name="Public:base" />
<block name="title">档口订单管理</block>
<block name="content">
    <div class=" ace-save-state" id="breadcrumbs">
        <div class="page-header">
            <h1>档口订单管理
                <small>
                    <i class="ace-icon fa fa-angle-double-right"></i><a href="javascript:;">{$titleName}</a>
                </small>
            </h1>
        </div>
        <!-- /.ace-settings-container -->
        <div class="page-content col-xs-11">
            <h2><?php echo $memberInfo['window_name']?>-<?php echo $order_date?>订单</h2><br>
            <hr>
            <div class="row">
                <div class="col-xs-6">
                    <!-- PAGE CONTENT BEGINS -->
                    <div class="col-xs-6" style="padding: 0;margin-bottom: 10px;margin-top: 10px">
                        <div class="input-group">
                            <span class="input-group-addon"><i class="fa fa-calendar-times-o"></i></span>
                            <input type="text" id="id-date-picker-1" value="<?php echo $order_date?>" class="form-control date-picker search-query" data-date-format="yyyy-mm-dd" placeholder="选择日期">
                            <span class="input-group-btn">
                                <button onclick="gogogo()" type="button" class="btn btn-inverse btn-white">
                                    <span class="ace-icon fa fa-search icon-on-right bigger-110"></span>
                                    查询
                                </button>
                            </span>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-xs-12">
                            <form id="ttbb" method="post" action="{:U('Admin/Order/saveEditWindowOrder')}">
                                <table id="simple-table" class="table  table-bordered table-hover">
                                    <input type="hidden" name="order_date" value="<?php echo $order_date?>">
                                    <thead>
                                    <tr>
                                        <th class="detail-col center">菜品名称</th>
                                        <th class="detail-col center">菜品类别</th>
                                        <th class="detail-col center">规格</th>
                                        <th class="center">数量</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <?php if(!empty($orderList)){?>
                                    <?php foreach($orderList as $k=>$l){?>
                                    <tr>
                                        <td class="center"><?php echo $l['item_name'];?></td>
                                        <td class="center"><?php echo $l['type_name'];?></td>
                                        <td class="center"><?php echo $l['item_unit_name'];?></td>
                                        <td class="center">
                                            <input jan="number" type="number" name="order[<?php echo $l['item_order_id']?>][number]" value="<?php echo $l['item_number'];?>">
                                        </td>
                                    </tr>
                                    <?php }?>
                                    <?php }else{?>
                                    <tr>
                                        <td colspan="4" class="center">没有找到相关订单菜品</td>
                                    </tr>
                                    <?php }?>
                                    </tbody>
                                </table>
                            </form>
                        </div><!-- /.span -->
                    </div><!-- /.row -->
                    <?php if(!empty($orderList)){?>
    
                    <button type="button" class="btn btn-sm btn-success" onclick="saveEditOrder()">
                        <span>保存修改</span>
                    </button>
                    <?php }?>
                    <!-- PAGE CONTENT ENDS -->
                </div><!-- /.col -->
            </div><!-- /.row -->
        </div>
    </div>
    <script>

        window.onload = function () {
            $('.date-picker').datepicker({
                autoclose: true,
                todayHighlight: true
            })
        }

        function saveEditOrder() {
            var flag = confirm("请确保订单数量无误，没有填写数量则算作为0,是继续？")
            if (flag == true) {
                $("#ttbb").submit()
            } else {

            }
            $("input[jan=number]").each(function () {

            })
        }
        function gogogo() {
            var date = $('#id-date-picker-1').val()
            window.location.href = "<?php echo U('Admin/Order/WindowOrder/');?>" + "/order_date/" + date+"/member_id/{$memberInfo['member_id']}"
        }
    </script>
</block>
<block name="js"></block>
